# Contributor: Joe Searle <joe@jsearle.net>
# Maintainer: Joe Searle <joe@jsearle.net>
pkgname=pastel
pkgver=0.10.0
pkgrel=0
pkgdesc="A command-line tool to generate, analyze, convert and manipulate colors"
url="https://github.com/sharkdp/pastel"
arch="all !s390x !riscv64" # rust/cargo
license="Apache-2.0"
makedepends="rust cargo cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://github.com/sharkdp/pastel/archive/v$pkgver.tar.gz"
subpackages="
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
options="net" # fetch crates


build() {
	export SHELL_COMPLETIONS_DIR="$builddir/completions"
	cargo auditable build --release
}

check() {
	cargo test
}

package() {
	install -Dm755 "target/release/pastel" "$pkgdir/usr/bin/$pkgname"

	install -Dm644 "$builddir"/completions/pastel.bash \
		"$pkgdir"/usr/share/bash-completion/completions/pastel
	install -Dm644 "$builddir"/completions/_pastel \
		"$pkgdir"/usr/share/zsh/site-functions/_pastel
	install -Dm644 "$builddir"/completions/pastel.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/pastel.fish
}

sha512sums="
1e79d964564346219e6170b37dba19cdf85b7245cd4e6640860339606da3237bec1cc1c67a909e03b979b168e72ecf6490a681bb3562302a9227d1a9bfc5e9f2  pastel-0.10.0.tar.gz
"
